from TestToolsV2.common.ActivityDatas import activityDatas
from TestToolsV2.common.MyConfig import myConfig
from TestToolsV2.components.ComponentsController import componentsController
from TestToolsV2.data.DataController import dataController
from TestToolsV2.events.MainEvents import mainEvents


class eventController:
    def __init__(self, components: componentsController, datas: dataController):
        self.mainEvents = None
        self.components = components
        self.datas = datas
        self.actyDatas = activityDatas()
        self.config = myConfig()

    def set_mainEvents(self):
        self.actyDatas.set_dialog(self.components.searchPathDialog, self.components.showDataDialog,
                                  self.components.settingDialog)
        self.config.settingDatas(self.datas.read_mainWindown)
        self.mainEvents = mainEvents(self.components.mainWindown, self.datas)
        self.mainEvents.set_tempDatas(self.actyDatas, self.config)

    def set_app(self, app):
        self.mainEvents.set_app(app)

    def get_mainEvents(self):
        if self.mainEvents:
            return self.mainEvents
        else:
            return None
